﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Library;

namespace QLKH.PopUp.KhuyenMai
{
    public partial class popThemGia : Form
    {
        public popThemGia()
        {
            InitializeComponent();
        }

        public delegate void Themgia(int outid);

        public Themgia MyFuntion;

        private void btquit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btsave_Click(object sender, EventArgs e)
        {
            if (MyFuntion != null)
            {
                Int16 magia = Int16.Parse((txtidgia.Text.Trim() == "") ? "0" : txtidgia.Text.Trim());
                Int16 tuso = Int16.Parse((txtTuso.Text.Trim() == "") ? "0" : txtTuso.Text.Trim());
                Int16 toiso = Int16.Parse((txttoiso.Text.Trim() == "") ? "0" : txttoiso.Text.Trim());
                int gia = int.Parse((txtGia.Text.Trim() == "") ? "0" : txtGia.Text.Trim());

                clGia adgia = new clGia();
                int outid = adgia.add(magia,tuso,toiso,gia);
                MyFuntion(outid);
            }
            this.Close();
        }
    }
}
